package cn.itcast.mr.debup;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

public class DedupDriver {

	public static void main(String[] args) throws Exception {
		Configuration conf = new Configuration();
		Job job = Job.getInstance(conf);
		job.setJarByClass(cn.itcast.mr.debup.DedupDriver.class);
		// TODO: specify a mapper
		job.setMapperClass(DedupMapper.class);
		// TODO: specify a reducer
		job.setReducerClass(DedupReducer.class);

		// TODO: specify output types
		job.setOutputKeyClass(Text.class);
		job.setOutputValueClass(NullWritable.class);

		// TODO: specify input and output DIRECTORIES (not files)
		FileInputFormat.setInputPaths(job, new Path("file:///D:\\Dedup\\input"));
		FileOutputFormat.setOutputPath(job, new Path("file:///D:\\Dedup\\output"));

		if (!job.waitForCompletion(true))
			return;
	}

}
